﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BPMS.Core.Builders
{
    public class InsertStatementBuilder : BuilderBase
    {
        public InsertStatementBuilder(Type type)
            : base(type)
        { }

        public override string GetOperateStatement()
        {
            Dictionary<string, string> fields = DataFieldList.Where(item => !item.IsIdentity).ToDictionary(GetDataColumnName, item => GetDataParameterName(item));
            return " INSERT INTO " + DataRecordName
            + "(" + string.Join(",", fields.Keys) + ")"
            + " VALUES (" + string.Join(",", fields.Values) + ")";
        }
    }
}
